package com.jlcindia.hibernate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.hibernate.*;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.cfg.Configuration;

public class Lab3Client2 {
	public static void main(String[] args) {
	Transaction tx = null;
	try{
		AnnotationConfiguration cfg = new AnnotationConfiguration();
		cfg = (AnnotationConfiguration) cfg.configure();
		SessionFactory sf = cfg.buildSessionFactory();
		Session session = sf.openSession();
		tx = session.beginTransaction();
		
		Student stu= (Student) session.load(Student.class, 1);
		
		System.out.println(stu.getSid()+"\t"+stu.getSname()+"\t"+stu.getDob());
		
		for(String cn: stu.getCourses()){
			System.out.println(cn);
		}
		System.out.println(stu.getEmails());
		System.out.println(stu.getMarks());
		System.out.println(stu.getPhones());
		System.out.println(stu.getRefs());
		
		tx.commit();
		session.close();
		}catch (Exception e) {
		e.printStackTrace();
	
	}
}}
